﻿using Microsoft.AspNetCore.Mvc;
using TR.AppService.AppService.BS;
using TR.AppService.AppService.Bs_WareArea;
using TR.AppService.Dto;
using TR.Domain.Entity;
using TR.Domain.Entity.BsItemType;
using TR.Domain.Repository.BS_Item_TypeRepository;
using TR.Domain.Repository.Bs_WareAreaRepository;

namespace TR.WebApi.Controllers.Bs_wareAreaControllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Bs_WareAreaControllers : ControllerBase
    {
       private readonly IBs_WareAreaService bs_WareAreaService;
        public Bs_WareAreaControllers(IBs_WareAreaService bs_WareAreaService)
        {
            this.bs_WareAreaService = bs_WareAreaService;
        }
        [HttpPost]
        public async Task<bool> wareAdd(bs_Ware_Area bs_Ware)
        {
            ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Console.WriteLine("ItemAdd--->");
            return await bs_WareAreaService.wareareaAdd(bs_Ware);
        }
        [HttpPost]
        public async Task<FenYe<bs_Ware_Area>> bs_Item_FenYe(int pageSize, int currentPage, string str)
        {
            ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
            return await bs_WareAreaService.warearea_FenYe(pageSize, currentPage, str);
        }
        [HttpPost]
        public async Task<bool> ItemTypeUpdate(bs_Ware_Area usd)
        {
            ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Console.WriteLine("ItemTypeUpdate--->");
            return await bs_WareAreaService.wareareaUpdate(usd);
        }
        [HttpGet]
        public Task<bs_Ware_Area> ItemTypeSelectid(int id)
        {
            ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Console.WriteLine("ItemTypeSelectid--->");
            return bs_WareAreaService.wareareaSelectid(id);
        }
        [HttpPost]
        public async Task<bool> ItemtypeUDelect(int id)
        {
            ControllerContext.HttpContext.Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Console.WriteLine("ItemtypeUDelect--->");
            return await bs_WareAreaService.wareareaUDelect(id);
        }
    }
}
